Load packages and data

Data cleaning

rest_inspec <- rest_inspec |>
  janitor::clean_names() |>
  separate(inspection_date, into = c("year", "month", "day"), sep = "-")
  
rest_inspec_filtered <- rest_inspec |>
  filter(year>=2013) |>
  group_by(boro, year) |>
  mutate(average_score = mean(score, na.rm = TRUE))

Cleaned names, separated inspection_date variable into day, month, and year, and filtered to only years 2013 and after in order to narrow down the dataset a bit. Also added a variable for average score for each boro each year.

Column

Chart A

rest_inspec_filtered |>
  filter(boro != "Missing") |>
  plot_ly(y = ~score, color = ~ boro, type = "box")
## Warning: Ignoring 21525 observations

Column

Chart B

rest_inspec_filtered |>
  filter(cuisine_description %in% c("American", "Italian", "Korean", "Thai", "Chinese", "Seafood", "Portuguese", "Mediterranean", "Sandwiches", "Spanish", "African", "Irish", "Mexican", "Delicatessen")) |>
    filter(boro != "Missing") |>
  plot_ly(x = ~cuisine_description, color = ~boro, type = "histogram")

Chart C

rest_inspec_filtered |>
  filter(boro != "Missing") |>
  plot_ly(x= ~year, y = ~average_score, color= ~boro, type="bar")